home *** CD-ROM | disk | FTP | other *** search
/ Scene 96 / Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso / misc / coding / cp2dekit / samples / smpgmode.cpp < prev    next >
C/C++ Source or Header  |  1996-12-29  |  2KB  |  112 lines

  1. //***************************************************************************
  2. //
  3. // this file is (c) '94-'96 Niklas Beisert
  4. //
  5. // this file is part of the cubic player development kit.
  6. // you may only use/modify/spread this file under the terms stated
  7. // in the cubic player development kit accompanying documentation.
  8. //
  9. //***************************************************************************
  10.  
  11. //[general]
  12. //  link=smpgmode
  13. //[screen]
  14. //  defmodes=_cpiModeGraphTest
  15. //press " to activate
  16.  
  17.  
  18.  
  19. // graphics mode example
  20.  
  21. #include <stdlib.h>
  22. #include <conio.h>
  23. #include <string.h>
  24. #include "poutput.h"
  25. #include "cpiface.h"
  26.  
  27. extern unsigned char *plCubicPict;
  28. extern unsigned char plCubicPal[];
  29.  
  30. static void plPrepareScopes()
  31. {
  32.   int i;
  33.   if (plCubicPict)
  34.   {
  35.     outp(0x3c8, 16);
  36.     for (i=0; i<720; i++)
  37.       outp(0x3c9, plCubicPal[i+48]);
  38.  
  39.     plSetGraphPage(0);
  40.     memcpy((char*)0xA0000+96*640, plCubicPict, 4096);
  41.     plSetGraphPage(1);
  42.     memcpy((char*)0xA0000, plCubicPict+4096, 65536);
  43.     plSetGraphPage(2);
  44.     memcpy((char*)0xA0000, plCubicPict+69632, 65536);
  45.     plSetGraphPage(3);
  46.     memcpy((char*)0xA0000, plCubicPict+135168, 65536);
  47.     plSetGraphPage(4);
  48.     memcpy((char*)0xA0000, plCubicPict+200704, 45056);
  49.   }
  50.   else
  51.   {
  52.     plSetGraphPage(0);
  53.     memset((char*)0xA0000+96*640, 0, 4096);
  54.     plSetGraphPage(1);
  55.     memset((char*)0xA0000, 0, 65536);
  56.     plSetGraphPage(2);
  57.     memset((char*)0xA0000, 0, 65536);
  58.     plSetGraphPage(3);
  59.     memset((char*)0xA0000, 0, 65536);
  60.     plSetGraphPage(4);
  61.     memset((char*)0xA0000, 0, 45056);
  62.   }
  63. }
  64.  
  65. static int plScopesKey(unsigned short key)
  66. {
  67.   return 0;
  68. }
  69.  
  70. static void scoDraw()
  71. {
  72.   cpiDrawGStrings();
  73. }
  74.  
  75. static void scoSetMode()
  76. {
  77.   plReadCubicPic();
  78.   cpiSetGraphMode(0);
  79.   plPrepareScopes();
  80.   gdrawstr(4, 0, "   testmode: ", 48, 0x09, 0);
  81. }
  82.  
  83. static int scoIProcessKey(unsigned short key)
  84. {
  85.   switch (key)
  86.   {
  87.   case '"':
  88.     cpiSetMode("gtest");
  89.     break;
  90.   default:
  91.     return 0;
  92.   }
  93.   return 1;
  94. }
  95.  
  96. static int scoEvent(int ev)
  97. {
  98.   switch (ev)
  99.   {
  100.   case cpievInitAll:
  101.     if (plVidType==vidNorm)
  102.       return 0;
  103.     return 1;
  104.   }
  105.   return 1;
  106. }
  107.  
  108. extern "C"
  109. {
  110.   cpimoderegstruct cpiModeGraphTest = {"gtest", scoSetMode, scoDraw, scoIProcessKey, plScopesKey, scoEvent};
  111. }
  112.